<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Catalago de Obras - Grupo 25: Referência do Arquivo dados.c</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Gerado por Doxygen 1.5.5 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Página&nbsp;Principal</span></a></li>
      <li><a href="annotated.html"><span>Estruturas&nbsp;de&nbsp;Dados</span></a></li>
      <li class="current"><a href="files.html"><span>Arquivos</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>Referência do Arquivo dados.c</h1><code>#include &quot;<a class="el" href="keys_8h-source.html">keys.h</a>&quot;</code><br>

<p>
<div class="dynheader">
Gráfico de dependência de inclusões para dados.c:</div>
<div class="dynsection">
<p><center><img src="dados_8c__incl.png" border="0" usemap="#dados.c_map" alt=""></center>
<map name="dados.c_map">
<area shape="rect" href="keys_8h.html" title="keys.h" alt="" coords="193,84,257,111"><area shape="rect" href="inserir_8h.html" title="inserir.h" alt="" coords="189,162,261,188"><area shape="rect" href="remove_8h.html" title="remove.h" alt="" coords="183,239,268,266"><area shape="rect" href="consulta_8h.html" title="consulta.h" alt="" coords="180,316,271,343"></map>
</div>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Funções</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dados_8c.html#e66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>

</table>
<hr><h2>Funções</h2>
<a class="anchor" name="e66f6b31b5ad750f1fe042a706a4e3d4"></a><!-- doxytag: member="dados.c::main" ref="e66f6b31b5ad750f1fe042a706a4e3d4" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
<div class="fragment"><pre class="fragment"><a name="l00004"></a>00004            {
<a name="l00005"></a>00005         <a class="code" href="structNo__PK.html">pNo_PK</a> obras, sk_titulo, sk_autor, sk_tipo, sk_ano;
<a name="l00006"></a>00006         <span class="keywordtype">int</span> n=0, tamanho=0, tautor = 0, ttitulo = 0, ttipo = 0, tano=0;
<a name="l00007"></a>00007         FILE *base, *avail;
<a name="l00008"></a>00008         <span class="keywordtype">char</span> tit[<a class="code" href="consulta_8h.html#4e08e3da16a5821367047709c8f0f2a6">tam_titulo</a>+1];
<a name="l00009"></a>00009         <span class="comment">/* roda a funcao para atualizar os arquivos de acordo com o base25.dat */</span>
<a name="l00010"></a>00010         <a class="code" href="keys_8c.html#5bbd0df5ab16b9def077546766685e56" title="Funcao para atualizar os arquivos de pk&amp;#39;s, alem de carregar as sks na memoria...">atualiza_arquivos</a>(&amp;obras, &amp;sk_titulo, &amp;sk_autor, &amp;sk_tipo, &amp;sk_ano, &amp;tamanho, &amp;tautor, &amp;ttitulo, &amp;ttipo, &amp;tano);
<a name="l00011"></a>00011         <span class="keywordflow">while</span> (n != 4) {  <span class="comment">/* inicio da interface com o usuario, mantem loop enquanto n diferente de 3 */</span>  
<a name="l00012"></a>00012                 printf(<span class="stringliteral">"**********************************************\n**********************************************\n**                                          **\n         1 - Adicionar novo titulo\n         2 - Realizar consultas\n         3 - Remover titulo\n         4 - Sair\n**                                          **\n**********************************************\n**********************************************\n"</span>);
<a name="l00013"></a>00013                 scanf(<span class="stringliteral">"%d"</span>, &amp;n);
<a name="l00014"></a>00014                 __fpurge(stdin);
<a name="l00015"></a>00015                 <span class="keywordflow">switch</span>(n) {
<a name="l00016"></a>00016                         <span class="keywordflow">case</span> 1:
<a name="l00017"></a>00017                                 <span class="keywordflow">if</span>(!(avail = fopen ( <span class="stringliteral">"avail_head.dat"</span> , <span class="stringliteral">"rb"</span> ))) <span class="comment">/* checa se avail_list ja existe, caso nao existe, ele cria com valor -001 */</span>
<a name="l00018"></a>00018                                         <a class="code" href="remove_8c.html#81d2780fd2ab9f3eabe0faf2eeff5022">cria_avail</a> ();
<a name="l00019"></a>00019                                 base = fopen (<span class="stringliteral">"base25.dat"</span>, <span class="stringliteral">"a"</span>);
<a name="l00020"></a>00020                                 <a class="code" href="inserir_8c.html#09e188938102b40356eb2042f8237316">insere</a>(tamanho, base, tit, &amp;obras); <span class="comment">/* entra na funcao insere do inserir.c */</span>
<a name="l00021"></a>00021                                 tamanho = tautor = ttitulo = ttipo = tano = 0; 
<a name="l00022"></a>00022                                 <span class="comment">/* reatualiza todos os arquivos */</span>
<a name="l00023"></a>00023                                 <a class="code" href="keys_8c.html#5bbd0df5ab16b9def077546766685e56" title="Funcao para atualizar os arquivos de pk&amp;#39;s, alem de carregar as sks na memoria...">atualiza_arquivos</a>(&amp;obras, &amp;sk_titulo, &amp;sk_autor, &amp;sk_tipo, &amp;sk_ano, &amp;tamanho, &amp;tautor, &amp;ttitulo, &amp;ttipo, &amp;tano);
<a name="l00024"></a>00024                                 <span class="keywordflow">break</span>;
<a name="l00025"></a>00025                         <span class="keywordflow">case</span> 2:
<a name="l00026"></a>00026                                 <a class="code" href="consulta_8c.html#add007a4d18704a7bbe1971ac81b5364">menu_consulta</a>(obras, tamanho, sk_titulo, sk_tipo, sk_autor, sk_ano, ttitulo, ttipo, tautor, tano, tamanho); <span class="comment">/* entra na secao de consulta */</span>
<a name="l00027"></a>00027                                 <span class="keywordflow">break</span>;
<a name="l00028"></a>00028                         <span class="keywordflow">case</span> 3:
<a name="l00029"></a>00029                                 <span class="keywordflow">if</span>(!(avail = fopen ( <span class="stringliteral">"avail_head.dat"</span> , <span class="stringliteral">"rb"</span> ))) <span class="comment">/* checa se avail_list ja existe, caso nao existe, ele cria com valor -001 */</span>
<a name="l00030"></a>00030                                         <a class="code" href="remove_8c.html#81d2780fd2ab9f3eabe0faf2eeff5022">cria_avail</a> ();
<a name="l00031"></a>00031                                 <a class="code" href="remove_8c.html#9bbf12ea3c272f4e62cf440eae0acb09">remocao</a>(obras, tamanho);
<a name="l00032"></a>00032                                 tamanho = tautor = ttitulo = ttipo = tano = 0;
<a name="l00033"></a>00033                                 <span class="comment">/* reatualiza todos os arquivos */</span>
<a name="l00034"></a>00034                                 <a class="code" href="keys_8c.html#5bbd0df5ab16b9def077546766685e56" title="Funcao para atualizar os arquivos de pk&amp;#39;s, alem de carregar as sks na memoria...">atualiza_arquivos</a>(&amp;obras, &amp;sk_titulo, &amp;sk_autor, &amp;sk_tipo, &amp;sk_ano, &amp;tamanho, &amp;tautor, &amp;ttitulo, &amp;ttipo, &amp;tano);
<a name="l00035"></a>00035                         <span class="keywordflow">case</span> 4:
<a name="l00036"></a>00036                                 <span class="keywordflow">break</span>;
<a name="l00037"></a>00037                         <span class="keywordflow">default</span>:
<a name="l00038"></a>00038                                 printf(<span class="stringliteral">"Opcao invalida\n"</span>);
<a name="l00039"></a>00039                                 <span class="keywordflow">break</span>;  
<a name="l00040"></a>00040                 }
<a name="l00041"></a>00041         }
<a name="l00042"></a>00042         <span class="keywordflow">if</span> (base = fopen (<span class="stringliteral">"base25.dat"</span>, <span class="stringliteral">"rb"</span>)) {
<a name="l00043"></a>00043 
<a name="l00044"></a>00044         <span class="comment">/* se a base existe a gravacao dos vetores de obras e sks precisam ser gravados em disco */</span> 
<a name="l00045"></a>00045         
<a name="l00046"></a>00046         <a class="code" href="keys_8c.html#ea04db294721998a079fa7b622376c47" title="Funcao para gravar as informacoes dos vetores de pk e sk em arquivos (nrr.dat e sk_*...">GravaArray</a>(<span class="stringliteral">"nrr.dat"</span>, tamanho, obras); 
<a name="l00047"></a>00047         <a class="code" href="keys_8c.html#ea04db294721998a079fa7b622376c47" title="Funcao para gravar as informacoes dos vetores de pk e sk em arquivos (nrr.dat e sk_*...">GravaArray</a>(<span class="stringliteral">"sk_titulo.dat"</span>, ttitulo, sk_titulo);
<a name="l00048"></a>00048         <a class="code" href="keys_8c.html#ea04db294721998a079fa7b622376c47" title="Funcao para gravar as informacoes dos vetores de pk e sk em arquivos (nrr.dat e sk_*...">GravaArray</a>(<span class="stringliteral">"sk_tipo.dat"</span>, ttipo, sk_tipo);
<a name="l00049"></a>00049         <a class="code" href="keys_8c.html#ea04db294721998a079fa7b622376c47" title="Funcao para gravar as informacoes dos vetores de pk e sk em arquivos (nrr.dat e sk_*...">GravaArray</a>(<span class="stringliteral">"sk_autor.dat"</span>, tautor, sk_autor);
<a name="l00050"></a>00050         <a class="code" href="keys_8c.html#ea04db294721998a079fa7b622376c47" title="Funcao para gravar as informacoes dos vetores de pk e sk em arquivos (nrr.dat e sk_*...">GravaArray</a>(<span class="stringliteral">"sk_ano.dat"</span>, tano, sk_ano); 
<a name="l00051"></a>00051         }
<a name="l00052"></a>00052 
<a name="l00053"></a>00053         <span class="comment">/*libera os vetores */</span>
<a name="l00054"></a>00054 
<a name="l00055"></a>00055         free(obras); 
<a name="l00056"></a>00056         free(sk_titulo);
<a name="l00057"></a>00057         free(sk_tipo);
<a name="l00058"></a>00058         free(sk_autor);
<a name="l00059"></a>00059         free(sk_ano);
<a name="l00060"></a>00060         printf(<span class="stringliteral">"Encerrando programa.\n"</span>); 
<a name="l00061"></a>00061         <span class="keywordflow">return</span> 0;       
<a name="l00062"></a>00062 }
</pre></div>
<p>

<p>
<div class="dynheader">
Este é o grafo de chamadas para esta função:</div>
<div class="dynsection">
<p><center><img src="dados_8c_e66f6b31b5ad750f1fe042a706a4e3d4_cgraph.png" border="0" usemap="#dados_8c_e66f6b31b5ad750f1fe042a706a4e3d4_cgraph_map" alt=""></center>
<map name="dados_8c_e66f6b31b5ad750f1fe042a706a4e3d4_cgraph_map">
<area shape="rect" href="keys_8c.html#5bbd0df5ab16b9def077546766685e56" title="Funcao para atualizar os arquivos de pk&#39;s, alem de carregar as sks na memoria..." alt="" coords="107,132,243,159"><area shape="rect" href="remove_8c.html#81d2780fd2ab9f3eabe0faf2eeff5022" title="cria_avail" alt="" coords="133,784,216,811"><area shape="rect" href="keys_8c.html#ea04db294721998a079fa7b622376c47" title="Funcao para gravar as informacoes dos vetores de pk e sk em arquivos (nrr.dat e sk_*..." alt="" coords="127,835,223,861"><area shape="rect" href="inserir_8c.html#09e188938102b40356eb2042f8237316" title="insere" alt="" coords="144,733,205,760"><area shape="rect" href="consulta_8c.html#add007a4d18704a7bbe1971ac81b5364" title="menu_consulta" alt="" coords="113,411,236,437"><area shape="rect" href="remove_8c.html#9bbf12ea3c272f4e62cf440eae0acb09" title="remocao" alt="" coords="308,563,388,589"><area shape="rect" href="consulta_8c.html#c3f135f977e97ce51bde811fe4850fb7" title="compara" alt="" coords="661,309,741,336"><area shape="rect" href="keys_8c.html#96adb663f79b48c0f5748190fd37254d" title="Funcao adicionar os registros de pk e sk na memoria em forma de vetor." alt="" coords="496,5,560,32"><area shape="rect" href="keys_8c.html#58624719cdc6ac00aa134c8a676937ca" title="Funcao adicionar os registros de pk e sk na memoria em forma de vetor." alt="" coords="303,107,393,133"><area shape="rect" href="keys_8c.html#05620ebe7f342b88290acca42decbb2d" title="Funcao para completar espacos." alt="" coords="663,81,740,108"><area shape="rect" href="keys_8c.html#ee839f2a736a2162764e7527cb163444" title="Funcao para transformar uma str em maiusculo." alt="" coords="477,208,579,235"><area shape="rect" href="keys_8c.html#7e0ecc99a20bbf339b8adc53999ea427" title="Funcao que escreve os arquivos pks." alt="" coords="489,56,567,83"><area shape="rect" href="inserir_8c.html#7c4ee3b9d090de7debc8627a9ec467b9" title="Ano" alt="" coords="325,816,371,843"><area shape="rect" href="inserir_8c.html#1f918dc0c11be8136b10639811b30ff0" title="Autor" alt="" coords="319,765,377,792"><area shape="rect" href="inserir_8c.html#17f1761d7fa8ca9ebd96b0e43d43f141" title="Imagem" alt="" coords="311,917,385,944"><area shape="rect" href="inserir_8c.html#86f4c9d5af1f3c351dfd4989c7e0e050" title="Tipo" alt="" coords="324,664,372,691"><area shape="rect" href="inserir_8c.html#c2f31d719ada641e76a5f5192bda2c38" title="Titulo" alt="" coords="319,613,377,640"><area shape="rect" href="inserir_8c.html#f3d37b1e5047923e2f386e2d6e035173" title="Valor" alt="" coords="321,867,375,893"><area shape="rect" href="inserir_8c.html#3984be3dc5afb73ad6b108f75442d6ec" title="verifica_avail" alt="" coords="295,968,401,995"><area shape="rect" href="inserir_8c.html#a11e0d6e82a681b31792c378cdc4fbf4" title="completa_espacos" alt="" coords="455,664,601,691"><area shape="rect" href="inserir_8c.html#ca633dc542efdd5fd5748989918dd125" title="remove_espacos" alt="" coords="460,740,596,767"><area shape="rect" href="inserir_8c.html#00c6be1b80810a935f1185dc4c2dc32b" title="verifica" alt="" coords="492,841,564,868"><area shape="rect" href="inserir_8c.html#9c79d622ec1a91518808ee0a01f04095" title="verifica_img" alt="" coords="477,917,579,944"><area shape="rect" href="consulta_8c.html#eed00783f1106de6aedbe9426ffbddfa" title="lista_HTML" alt="" coords="481,461,575,488"><area shape="rect" href="consulta_8c.html#699f52652fddf04d22bee4071e6708b4" title="procura_ano" alt="" coords="297,360,399,387"><area shape="rect" href="consulta_8c.html#b4ab26e15edfbbb19de5f9b2f5a7b99b" title="procura_autor" alt="" coords="291,411,405,437"><area shape="rect" href="consulta_8c.html#2974665ec88cd1779f6dcbd6402cea66" title="procura_tipo" alt="" coords="296,259,400,285"><area shape="rect" href="consulta_8c.html#f8370cb3ddb988de92dca1314db5a026" title="procura_tit" alt="" coords="300,309,396,336"><area shape="rect" href="consulta_8c.html#3bb21c11aa7c3a2f16e4c558bfdb6e0a" title="fim_HTML" alt="" coords="657,461,745,488"><area shape="rect" href="consulta_8c.html#16cfbe6d5b5d3280f3e36383eadab7ad" title="inicio_HTML" alt="" coords="652,360,751,387"><area shape="rect" href="consulta_8c.html#e68d4899f52d357d21501d285957cb60" title="meio_HTML" alt="" coords="652,411,751,437"><area shape="rect" href="consulta_8c.html#cc1c5e3054a7ddb2dc7efd67be869bb0" title="escreve" alt="" coords="817,385,892,412"><area shape="rect" href="consulta_8c.html#64145c5100918b6c0cfeb0f521897fef" title="escreve_img" alt="" coords="801,436,908,463"><area shape="rect" href="consulta_8c.html#9a40fa0763c3859402d92a2e4e1105e8" title="procura_aux" alt="" coords="477,309,579,336"></map>
</div>

</div>
</div><p>
</div>
<hr size="1"><address style="text-align: right;"><small>Gerado em Mon Apr 28 16:38:40 2008 para Catalago de Obras - Grupo 25 por&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
</body>
</html>
